<template>
  <view>
    <view @click="goTest(t.tid)" v-for="t in tests">
      <uni-card :title="t.ttitle" :extra="t.ttotal+`题`">
        <text class="uni-body">{{t.tdesc}}</text>
      </uni-card>
      <uni-card :title="t.ttitle" :extra="t.ttotal+`题`">
        <text class="uni-body">{{t.tdesc}}</text>
      </uni-card>
    </view>

  </view>
</template>

<script>
  export default {
    data() {
      return {
        tests: {}

      }
    },
    created() {
      this.getTestList();
    },
    methods: {
      getTestList() {
        uni.request({
          url: 'http://127.0.0.1:800/mhs/test/getTestList',
          header: {
            token: uni.getStorageSync('token')
          },
          success: (res) => {
            this.tests = res.data.data;

            console.log(this.tests);
            console.log(res.data.data);
          }
        })
      },

      goTest(id) {
        uni.navigateTo({
          url: '/pages/test/test?tid=' + id
        })
        console.log(id);
      }

    }
  }
</script>

<style>

</style>